﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomReport.aspx.cs" Inherits="client_CustomReport" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Vibration Report</title>
    <link href="../styles/client.css" rel="stylesheet" type="text/css" />
    <link href="../styles/lytebox.css" rel="stylesheet" type="text/css" media="screen" />

    <script src="../javascripts/lytebox.js" type="text/javascript"></script>

</head>
<body>
    <div class="content_area" style="min-height: 1100px">
        <h2>
            Custom Report
        </h2>
        <form id="form1" runat="server" class="cust_report">
        <asp:ScriptManager EnablePartialRendering="true" ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:SqlDataSource ID="SqlDataSourceDateRecorded" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT CONVERT(varchar(10), ComponentStatus.dateRecorded, 3) as dateRecorded1
                    FROM ComponentStatus , Components , Machines 
                    WHERE ComponentStatus.component_id = Components.component_id 
                    AND Components.machine_id = Machines.machine_id
                     AND (Components.machine_id = @id)
                     Group by ComponentStatus.dateRecorded">
            <SelectParameters>
                <asp:QueryStringParameter Name="id" QueryStringField="id" />
            </SelectParameters>
        </asp:SqlDataSource>
        <table>
            <tr>
                <td class="label">
                    Select Client
                </td>
                <td>
                    <asp:DropDownList ID="DropDownClientList" AutoPostBack="true" runat="server" OnSelectedIndexChanged="Client_Changed"
                        DataTextField="clientName" DataValueField="clientid" CssClass="DropDownList">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="label">
                    Select Sites
                </td>
                <td>
                    <asp:DropDownList ID="SelectSite_DropDownList1" AutoPostBack="true" runat="server"
                        OnSelectedIndexChanged="Site_changed" DataTextField="SiteName" DataValueField="siteid"
                        CssClass="DropDownList">
                        <asp:ListItem>Any</asp:ListItem>
                        <asp:ListItem>Choose Sites</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:UpdatePanel ID="upnl" runat="server">
                        <ContentTemplate>
                            <asp:CheckBoxList ID="SitesCheckBoxList" runat="server" CssClass="CheckBoxList">
                            </asp:CheckBoxList>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="SelectSite_DropDownList1" />
                        </Triggers>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
                <td class="label">
                    Select Severity
                </td>
                <td>
                    <asp:DropDownList ID="SelectSeverity_DropDownList" AutoPostBack="true" runat="server"
                        OnSelectedIndexChanged="Severity_changed" DataTextField="clientName" DataValueField="clientid"
                        CssClass="DropDownList ">
                        <asp:ListItem>Any</asp:ListItem>
                        <asp:ListItem>Choose Severity</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:UpdatePanel ID="upnl0" runat="server">
                        <ContentTemplate>
                            <asp:CheckBoxList ID="SeverityCheckBoxList" runat="server" CssClass="CheckBoxList">
                            </asp:CheckBoxList>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="SelectSeverity_DropDownList" />
                        </Triggers>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
                <td class="label">
                    <asp:Label ID="DateLabel" runat="server" Text="Select a date">
                    </asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="DropDownListDate" runat="server" DataSourceID="SqlDataSourceDateRecorded"
                        DataTextField="dateRecorded1"  DataValueField="dateRecorded1"
                        CssClass="DropDownList">
                        <asp:ListItem></asp:ListItem>
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="DropDownListDate"
                        ErrorMessage="One date should be chosen!" CssClass="RequiredFieldValidator"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="Full_Report_Button" runat="server" Text="Get Report" OnClick="FullReport"
                        CssClass="buttons" />
                </td>
            </tr>
        </table>
        </form>
    </div>
</body>
<%--DataTextFormatString=" {0:d}"--%>
</html>
